﻿using Serietheque.Properties;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Serietheque
{
    [MetadataType(typeof(Series))]
    partial class Series
    {
        public bool IsValide()
        {
            try
            {
                if (String.IsNullOrWhiteSpace(this.Name))
                {
                    return false;
                }
                else
                    return true;
            }
            catch (Exception e)
            {
                e.ToString();
                return false;
                throw;
            }
        }

        public int GetEpisodesCount()
        {
            int i = 0;

            Parallel.ForEach(this.Saisons, s =>
            {
                if (s.Episodes != null)
                    i += s.Episodes.Count;
            });

            return i;
        }


    }
}
